<?php
/**
 * Created by PhpStorm.
 * User: xuhongyi
 * Date: 2019/10/25
 * Time: 16:11
 */
error_reporting(E_ALL);
ini_set('display_errors','on');
$access_token=$_GET['access_token'] ? $_GET['access_token'] : false;
if (!$access_token){
    exit('请求错误');
}
$redis = new Redis();
$redis->connect('localhost', 6379);
$redis->auth('zxc86506859');
$exits=$redis->exists($access_token);   //判断用户请求的access_token是否存在
if ($exits){
    $user_info=$redis->get($access_token);
    $arr=[
        'msg'=>'请求成功',
        'code'=>200,
        'user_info'=>$user_info
    ];
    exit(json_encode($arr));
}

$arr=[
    'msg'=>'请求失败',
    'code'=>400
];
exit(json_encode($arr));